{% extends base %}

<!-- 查看标签视图 -->

{% block body %}
    {% include message/component/message_header.html %}

    {% if message_tag == "calendar" %}
        <!-- 月份选择器 -->
        {% include common/date/month_picker.html %}
    {% end %}

    <div class="card">
        {% if len(tag_list) == 0 %}
            {% include common/text/empty_text.html %}
        {% end %}

        {% for tag_item in tag_list %}
            <a href="{{ tag_item.url }}" class="list-link">
                <span>{{ tag_item.name }}</span>
                <div class="float-right">
                    <span class="book-size-span">{{ tag_item.amount }}</span>
                    <i class="fa fa-chevron-right"></i>
                </div>
            </a>
        {% end %}
    </div>

    <script type="text/javascript">
        $(function (e) {
            
            function getInputTag() {
                return getUrlParam("tag", "");
            }

            function getDisplayTag() {
                return getUrlParam("displayTag", "");
            }

            function copyFromUrl() {
                var url = "?"
                for (var i = 0; i < arguments.length; i++) {
                    var key = arguments[i];
                    var value = getUrlParam(key, "");
                    if (i !== 0) {
                        url += "&";
                    }
                    url += key + "=" + value;
                }
                return url;
            }

            function onMonthSelected(event) {
                var date = event.target;
                window.location.href = copyFromUrl("tag", "displayTag", "orderby") + "&date=" + date;
            }

            xnote.on("date.month.selected", onMonthSelected);
        })
    </script>


{% end %}
  